﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sasc.PV.BLL;
using Sasc.PV.DAL;

namespace Sasc.PV.Web.Admin.SystemManage
{
    public partial class TreeListAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //设置上传的附件为空
                PublicMethod.SetSessionValue("WenJianList", "");
                this.Label1.Text = DbHelperSQL.GetSHSLInt("select top 1 ValueStr from ERPTreeList order by ID desc");

            }
        }
        //提交
        protected void SubmitImageButton_Click(object sender, ImageClickEventArgs e)
        {
            if (PublicMethod.IFExists("ValueStr", "ERPTreeList", 0, this.txtValueStr.Text) == true)
            {
                ERPTreeList Model = new ERPTreeList();

                Model.TextStr = this.txtTextStr.Text.ToString();
                Model.ImageUrlStr = this.txtImageUrlStr.Text.ToString();
                Model.ValueStr = this.txtValueStr.Text.ToString();
                Model.NavigateUrlStr = this.txtNavigateUrlStr.Text.ToString();
                Model.Target = this.txtTarget.Text.ToString();
                Model.ParentID = int.Parse(this.txtParentID.Text);
                Model.QuanXianList = this.txtQuanXianList.Text.ToString();
                Model.PaiXuStr = int.Parse(this.txtPaiXuStr.Text);

                Model.Add();

                //写系统日志
               ERPRiZhi MyRiZhi = new ERPRiZhi();
                MyRiZhi.UserName = PublicMethod.GetSessionValue("UserName");
                MyRiZhi.DoSomething = "用户添加菜单管理信息(" + this.txtTextStr.Text + ")";
                MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
                MyRiZhi.Add();

                MessageBox.ShowAndRedirect(this, "菜单管理信息添加成功！", "TreeList.aspx");
            }
            else
            {
                MessageBox.Show(this, "当前指定的后台数值已经存在，为了保持唯一性，请重新指定！");
            }
        }


    }
}